$(document).ready(function(){ $('.tutorial-button-modal').click(function(e){ e.preventDefault(); var video_id = $(this).data('videoid'); var title = $(this).data('title'); loadVideo(video_id,title); if($('#tutorialDialog').hasClass('dialog')){ $('#Mask').full().center().fadeIn(); $('#tutorialDialog').center().show(); } }); $('.close-tut-modal').click((e)=>{ e.preventDefault(); $('#Mask').fadeOut(); $('#tutorialDialog').hide(); $('#tutorial_content').html(''); }); $('#tutorialDialog').on('hidden.bs.modal',function(e){ $('#tutorial_content').html(''); }) }); function loadVideo(video,title){ $('#tutorial_content').html(``); $('#tutorial_title').html(title); }